<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" isELIgnored="false" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>亚马逊 - 注册页</title>
    <link href="${pageContext.request.contextPath}/css/index.css" rel="stylesheet" type="text/css"/>
    <link href="${pageContext.request.contextPath}/css/adv.css" rel="stylesheet" type="text/css"/>
    <link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css"/>
    <script src="${pageContext.request.contextPath}/scripts/jquery-2.1.0.js" type="text/javascript"></script>
    <script src="${pageContext.request.contextPath}/scripts/adv.js" type="text/javascript"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/function.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/index.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery-2.1.0.js"></script>
    <script>
        var $username, $pwd, $affim, $sex, $birth, $idcard, $email, $phone, $address, $codes, $register;
        $(function () {
            $username = $("#userName");
            $pwd = $("#pass");
            $affim = $("#affim");
            $sex = $(".sex");
            $birth = $("#birthday");
            $idcard = $("#idcard");
            $email = $("#emails");
            $phone = $("#phone");
            $address = $("#address");
            $codes = $("#codes");
            $register = $("#regist");
            $register.click(function () {
                $.post("${pageContext.request.contextPath}/lr", {
                    "uname": $username.val(),
                    "pwd": $pwd.val(),
                    // "affim":$affim.val(),
                    "sex": $sex.val(),
                    "birth": $birth.val(),
                    "idcard": $idcard.val(),
                    "email": $email.val(),
                    "phone": $phone.val(),
                    "address": $address.val(),
                    "code": $codes.val(),
                    "param": "register"


                }, function (data) {
                    alert(JSON.stringify(data))
                    if (data.success == true) {
                        window.location = "${pageContext.request.contextPath}/reg-result.jsp";
                    } else {
                        alert("lost");
                        window.location = "${pageContext.request.contextPath}/register.jsp";
                    }
                }, "json");
            })

        })
    </script>

</head>
<body>
<%@ include file="index_top.jsp" %>

<div id="register" class="wrap">
    <div class="shadow">
        <em class="corner lb"></em>
        <em class="corner rt"></em>
        <div class="box">
            <h1>欢迎注册亚马逊</h1>
            <ul class="steps clearfix">
                <li class="current"><em></em>填写注册信息</li>
                <li class="last"><em></em>注册成功</li>
            </ul>
            <form id="regForm" onsubmit="return checkForm(this)">
                <table>
                    <tr>
                        <td class="field">用户名：</td>
                        <td><input id="userName" class="text" type="text" name="userName" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" maxlength="15"/><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">登录密码：</td>
                        <td><input class="text" type="password" id="pass" name="passWord" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);"/><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">确认密码：</td>
                        <td><input class="text" type="password" name="rePassWord" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" id="affim"/><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">性别：</td>
                        <td><input type="radio" name="sex" style="border:0px;" checked="checked" value="0" class="sex"/>男<input
                                type="radio" name="sex" style="border:0px;" value="1" class="sex"/>女<span></span></td>
                    </tr>
                    <tr>
                        <td class="field">出生日期：</td>
                        <td><input class="text" type="text" name="birthday" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" id="birthday"/><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">身份证：</td>
                        <td><input class="text" type="text" name="identity" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" id="idcard"/><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">电子邮件：</td>
                        <td><input class="text" type="text" name="email" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" onmouseout="checkEmail()" id="emails"/><span
                                id="uemail"></span></td>
                    </tr>
                    <tr>
                        <td class="field">手机：</td>
                        <td><input class="text" type="text" name="mobile" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" id="phone"/><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">地址：</td>
                        <td><input class="text" type="text" name="address" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" id="address"/><span></span></td>
                    </tr>
                    <tr>
                        <td class="field">验证码：</td>
                        <td><input class="text verycode" type="text" name="veryCode" onfocus="FocusItem(this)"
                                   onblur="CheckItem(this);" maxlength="4" id="codes"/><img id="veryCode"
                                                                                            src="${pageContext.request.contextPath}/validateCode"/><span
                                id="Code"></span></td>
                    </tr>
                    <tr>
                        <td></td>
                        <td><label class="ui-green"><input type="button" name="submit" value="提交注册"
                                                           id="regist"/></label></td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <div class="clear"></div>
</div>
<div id="footer">
    Copyright &copy; 2018 上海海文 All Rights Reserved. 京ICP证1000001号
</div>
</body>
</html>

